package info.sean.constant;

/**
 * @author bohan
 * <p>
 * 目前统一使用11位，前三位为子系统码，中间4位为子系统模块功能码，最后四位为逻辑异常码
 * 通用的子系统返回码请使用framework中的com.ance.framework.common.utils.code.CommonRspCode
 * BEC系统码：102
 */
public enum BecRspCode implements RspCode {

	/**
	 * 模块1错误
	 */
	ERR_REQUIRED_PARAMS_CAN_NOT_BE_NULL("必填参数 %s 不能为空", "01102010001"),
	ERR_REQUIRED_PARAMS_ALL_NOT_BE_NULL("必填参数 %s 不能全为空", "01102010001"),
	ERR_LOANON_ALREADY_EXISTS("通用贷款单号已存在", "01102010002"),
	ERR_PARAMS_IS_NULL("参数传输异常","01102010003"),
	ERR_BIDDING_NO_EXISTS("标的信息不存在","01102010004"),
	ERR_UPDATE_BANKCARDNO_FAIL("更新银行卡号失败","01102010005"),
	ERR_PARAMS_CAN_NOT_ALL_BE_NULL("标的编号和借款人编号不能同时为空","01102010006"),
	ERR_BATCH_FAIL_BIDDING_FAIL("批量流标失败","01102010007"),
	ERR_BIDDINGNO_AND_LOANNO_CAN_NOT_ALL_BE_NULL("标的编号和通用贷款人编号不能同时为空","01102010008"),
	ERR_INVESTOR_SIZE_ERROR("出资类型和出资人数量不一致","01102010009"),
	ERR_TOTAL_INVESTOR_RATIO_ERROR("出资比例总和不等于100%","01102010010"),
	ERR_BIDDING_STATUS_INCONFORMITY("标的状态不符合预期","01102010011"),
	ERR_BIDDING_STATUS_FORBID_CHANGE_BANK_CARD("标的状态禁止更换该类型的银行卡","01102010012"),
	ERR_BIDDING_STAGE_ILLEGAL("标的期次不合理","01102010013"),
	ERR_BIDDING_GET_LOCK("获取标的锁异常","01102010014"),
	ERR_BIDDING_REPEAT_REQUEST("重复请求标的异常","01102010015"),
	ERR_BIDDING_DUBBO_REQUEST("标的dubbo请求异常","01102010016"),

	ERR_TRACKING_NO_DUPLICATE("追踪编号重复","01102090000"),
	ERR_CREATE_BIDDING_DUPLICATE("重复创建标的","01102090001"),
	ERR_QUERY_SIZE_ERROR("查询数量不正确","01102090002"),
	ERR_UPDATE_LOAN_NO_AND_BIDDING_NO_NOT_EXIST_TOGETHER("标的编号和通用贷款单号不能同时存在","01102090003"),
	ERR_CAPITALCODE_AND_CHANNELSOURCE_NOT_ALL_BE_NULL("资方编号和渠道来源不能同时为空","01102090004"),
	ERR_MODIFY_DATA_FAIL("更新标的数据失败","01102090005"),
	/**
	 * 依赖系统错误 - 系统1错误
	 */
	ERR_FUND_QUERY_MEMBER_NOT_EXIST("查询的会员不存在", "10200030001"),
	//提前结清切换标识错误
	PRE_SETTLE_SWITCH_FLAG("提前结清切换标识错误", "10200030002");

	private String code;

	private String message;

	private BecRspCode(String message, String code) {
		this.code = code;
		this.message = message;
	}

	public String getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	public static BecRspCode getEnum(String value) {
		BecRspCode[] crc = BecRspCode.values();
		for (int i = 0; i < crc.length; i++) {
			if (crc[i].getCode().equals(value)) {
				return crc[i];
			}
		}
		return null;
	}
}
